package com.et114.components.acegi.intercept.web;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

//import org.acegisecurity.concurrent.SessionRegistry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;

//import java.util.Map;

import com.et114.components.acegi.Constants;
import com.et114.modules.org.utility.SessionUserInfo;

/**
 * session 检查 功能由acegi 替代  
 * 此过滤器功能为检查 密码修改
 * @author guanhw
 *
 */
public class SessionFilter extends HttpServlet implements Filter {
	private static final long	serialVersionUID	= 342307951331914571L;
	protected Log logger = LogFactory.getLog( this.getClass( ) );
	static String  TYPE_CAS = "cas" ; 
	String type = null ; 
	String casTargetUrl = null ; 

	//TODO  调理 待重构
	public void doFilter ( ServletRequest arg0 , ServletResponse arg1 ,
			FilterChain arg2 ) throws IOException , ServletException {
		// TODO Auto-generated method stub
		HttpServletRequest request = ( HttpServletRequest ) arg0 ;
		HttpServletResponse response = ( HttpServletResponse ) arg1 ; 
		
        response.setHeader( "progma", "no-cache" );
        response.setHeader( "Cache-Control", "public" );
		

		arg2.doFilter ( arg0 , arg1 )  ;
	}
	
	public void init ( FilterConfig arg0 ) throws ServletException {
		// TODO Auto-generated method stub
		casTargetUrl = arg0.getInitParameter ( "casTargetUrl" ) ; 
		type = arg0.getInitParameter ( "type" ) ;
	}
	
	/**
	 * Constructor of the object.
	 */
	public SessionFilter ( ) {
		super ( );
	}
	
	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy ( ) {
		super.destroy ( ); // Just puts "destroy" string in log
		// Put your code here
	}
	
	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init ( ) throws ServletException {
		// Put your code here
	}
	
}
